#include <bits/stdc++.h>
using namespace std;
int maps[1005][1005];
int main()
{
	
	int l =0,w = 0;
	scanf("%d %d",&l,&w);
	for (int i = 1; i <= l; i++)
	{
		for (int j = 1; j <= w; j++)
		{
			scanf("%d",&maps[i][j]);
			

		}
	}
	
	for (int i = 1; i <= l; i++)
	{
		for (int j = 1; j <= w; j++)
		{
			maps[i][j] = maps[i][j] + maps[i][j - 1] + maps[i-1][j]- maps[i -1][j - 1];
		}
	}
	int a,b;
	cin >> a >> b;
 
	int m = maps[a][b];
	for (int i = a ; i <= l; i++)
	{
		for (int j = b ; j <= w; j++)
		{
			int n = maps[i][j] - maps[i-a][j] - maps[i][j - b] + maps[i-a][j-b];
			if (m < n)
				m = n;
		}
	}
	cout << m;
	return 0;
}
